<template>
  <el-menu router style="height: 100%">
    <el-menu-item
      :index="'/' + child.frontpath"
      v-for="child in menuList"
      :key="child.id"
    >
      {{ child.name }}</el-menu-item
    >
  </el-menu>
</template>

<script>
export default {
  name: "MyAside",
  data() {
    return {
      /***
       * 菜单列表
       */
      menuList: [],
    };
  },
  watch: {
    "$store.state.activeMenuId": {
      immediate:true,
      handler(newValue) {
        this.menuList =
          this.$store.getters.tree.find((c) => c.id === newValue)?.child ?? [];
      },
    },
  },
};
</script>

<style lang="scss" scoped>
.asidebox {
  height: 100%;
}
</style>